package cluedo;

import java.util.*;


public class Player {
	/**
	 * Name of this player
	 */
	private int name;

	/**
	 * Items the player is carrying
	 */
	private List<Character> characters;
	private List<Weapon> weapons;
	private List<Room> rooms;

	public Player(int name) {
		this.name = name;
		this.weapons = new ArrayList<Weapon>();
		this.characters = new ArrayList<Character>();
		this.rooms = new ArrayList<Room>();
	}

	/**
	 * Get name of this player
	 */
	public int getName() { return name; }

	public void addCard(Card i) {
		if(i instanceof Weapon)
			weapons.add((Weapon)i);
		else if(i instanceof Character)
			characters.add((Character)i);
		else
			rooms.add((Room)i);
	}

	public boolean hasItem(Card i) {
		
		if(i instanceof Weapon)
			if(weapons.contains((Weapon)i)) return true;
		else if (i instanceof Character)
			if(characters.contains((Character)i)) return true;
		else
			if(rooms.contains((Room)i)) return true;
				
		return false;
	}
	
	/**
	 * Get items the player is carrying
	 *
	 * @return
	 */
	public List<Character> getCharacters() { return characters; }

}
